package com.liang.threaddemo9;

import java.util.concurrent.ArrayBlockingQueue;

public class Foodie1 extends Thread{
    private ArrayBlockingQueue<String> list;

    public Foodie1(ArrayBlockingQueue<String> list) {
        this.list = list;
    }

    @Override
    public void run() {
        while (true) {
            String take = null;
            try {
                take = list.take();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(Thread.currentThread().getName()+"正在吃"+take);
        }
    }

}
